home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Mac Mega CD - Killer Software
/
The Mac Mega CD - Killer Software (May 1996).dmg
/
Shareware City
/
Applications
/
Chipmunk Basic 3.2.8
/
sieve.bas
< prev
next >
Encoding:
Amiga
Atari
Commodore
DOS
FM Towns/JPY
Macintosh
Macintosh JP
Macintosh to JP
NeXTSTEP
RISC OS/Acorn
Shift JIS
UTF-8
Wrap
BASIC Source File
|
1994-03-23
|
432 b
|
22 lines
|
[
TEXT/cBaS
]
10 rem sieve 6/1/92 test
20 loops = 1
30 t = timer
40 dim f(8194)
50 for j = 1 to loops
60 c = 0
70 s = 8191
80 for i = 0 to s : f(i) = 1 : next i
90 for i = 0 to s
100 if f(i) = 0 then goto 140
110 p = i+i+3
115 if i+p > s then 130
120 for k = i+p to s step p : f(k) = 0 : next k
130 c = c+1
140 next i
150 next j
160 print c;" primes found ";
170 t = timer-t
180 print loops;" times in ";
190 print t;" seconds"
200 end